package gitlab_hook

import "atomgit.com/openlinksaas-org/proto-gen-go.git/events/events_gitlab"

type IssueHook struct {
	ObjectKind       string           `json:"object_kind"`
	User             User             `json:"user"`
	Project          Project          `json:"project"`
	Repository       Repository       `json:"repository"`
	ObjectAttributes ObjectAttributes `json:"object_attributes"`
	Assignee         Assignee         `json:"assignee"`
	Changes          Changes          `json:"changes"`
}

func (item *IssueHook) ToProtoBuf() *events_gitlab.IssueEvent {
	return &events_gitlab.IssueEvent{
		ObjectKind:       item.ObjectKind,
		User:             item.User.ToProtoBuf(),
		Project:          item.Project.ToProtoBuf(),
		Repository:       item.Repository.ToProtoBuf(),
		ObjectAttributes: item.ObjectAttributes.ToProtoBuf(),
		Assignee:         item.Assignee.ToProtoBuf(),
		Changes:          item.Changes.ToProtoBuf(),
	}
}
